//
//  baseTableViewController.swift
//  SinaWeibo
//
//  Created by mac on 16/2/16.
//  Copyright © 2016年 mac. All rights reserved.

//base基础

import UIKit

class baseTableViewController: UITableViewController,VisitorLoginViewDelegate {
    //标记用户是否登录
    var userLogin = AccountViewModel.sharedAccountViewModel.userLogin
    //访客视图属性
    var visitorLoginViews: visitorLoginView?

    override func loadView() {
        if userLogin{
            super.loadView()
        }else{
            //显示自定义的访客视图 引导用户登录或者注册
            visitorLoginViews = visitorLoginView()
            //            v.backgroundColor = UIColor.purpleColor()
            visitorLoginViews?.visitorLoginViewDelegate = self
            view = visitorLoginViews
            //print(view)
            navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登录", style: .Plain, target: self, action: "userWillLogin")
            navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: "userWillRegister")
            
        }
    }
    func userWillLogin(){
        let oauth = oauthViewController()
        let nav = UINavigationController(rootViewController: oauth)
        presentViewController(nav, animated: true, completion: nil)
    }
    func userWillRegister(){
        
    
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()    
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    // MARK: - Table view data source

    }
